#ifndef __TILETAG__
#define __TILETAG__

#include <array>
#include <tuple>
#include <iostream>

using namespace std;

template<int TILETAGDIM, int TASKDIM>
class TileTag {
  std::array<int64_t, TILETAGDIM> m_arr;
  
public:
  TileTag() = delete;

  template <typename... Sizes> constexpr 
  TileTag(Sizes... sizes) : m_arr{{std::forward<Sizes>(sizes)...}}{
    static_assert(TILETAGDIM == sizeof...(Sizes), "ERROR");
    // const int64_t tmp[] = { static_cast<int64_t>(sizes)... };
    // for (int i=0; i<sizeof...(Sizes); i++)  {
    //   m_arr[i] = tmp[i];
    // }
  }

  constexpr TileTag(const TileTag &tt) : m_arr(tt.m_arr) {}  

  constexpr bool operator==(const TileTag &tt) const {
    // for (int i=0; i<TASKDIM; i++)  {
    //   if (m_arr[i] != tt[i]) return false;
    // }
    // return true;
    return (tt.m_arr == m_arr);
  }

  constexpr operator size_t() const {
    return TILETAGDIM * sizeof (int64_t);
  }

  // Find a workaround to make this constexpr
  // See for instance: https://gist.github.com/1457531
  int64_t operator[](int64_t i) const {
    return m_arr[i];
  }
};

#endif // __TILETAG__
